package com.handinglian.ai.record.enums;

public enum PhoneStatusEnum {
    CALL_FAILURE(0,"呼叫失败"),
    NOT_ANSWER(1,"无应答"),
    ANSWER(2,"已应答"),
    WAIT_TO_EXECUTE(-1,"待执行");

    public static PhoneStatusEnum valueOfOrdinal(Integer ordinal) {
        return ordinal == null || ordinal >= values().length ? null : values()[ordinal];
    }
    public static PhoneStatusEnum valueOfDesc(String desc) {
        for(PhoneStatusEnum phoneStatusEnum : PhoneStatusEnum.values()){
            if(desc.equals(phoneStatusEnum.getDescription())){
                return phoneStatusEnum;
            }
        }
        return null;
    }
    public static PhoneStatusEnum valueOfKey(Integer key){
        for(PhoneStatusEnum phoneStatusEnum : PhoneStatusEnum.values()){
            if(phoneStatusEnum.getKey()==key){
                return phoneStatusEnum;
            }
        }
        return null;
    }
    private final Integer key;
    private final String description;

    PhoneStatusEnum(Integer key, String description) {
        this.key = key;
        this.description = description;
    }

    public Integer getKey() {
        return key;
    }
    public String getDescription() {
        return this.description;
    }
}
